﻿package plugin.fashen.game
{
    import base.*;
    import com.core.*;
    import com.greensock.*;
    import com.sh.game.consts.*;
    import com.sh.game.display.*;
    import com.sh.game.global.*;
    import com.sh.game.util.*;
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.net.*;
    import flash.utils.*;
    import manager.*;
    import morn.core.components.*;
    import morn.core.handlers.*;
    import plugin.component.view.*;
    import plugin.fashen.*;
    import plugin.fashen.model.*;
    import pluginfw.nio.*;
    import uiresource.*;
    import view.message.*;

    public class FaShenUICtrl extends FaShenUI
    {
        private var _close:Function;
        private var selectHero:Object = null;
        private var curJiHuoHero:int = 0;
        private var JHHeros:Array;
        private var maxId:int;
        private var zhaohuanHero:Object;
        private var heroType:int = 0;
        private var timer1:Timer;
        private var curtime1:int;
        private var cfgHero:Object;
        private var cfgHeroLimit:Array;
        private var cfgMonsters:Array;
        private var cfgSkill:Object;
        private var cfgItem:Object;
        private var cfgStore:Object;
        private var cfgGuanzhi:Object;
        private var cfgMapList:Array;
        private var _ringTimer:RingTimer;
        private var _speed:int = 1;
        private var arrXY:Array;
        private var arrXY1:Array;
        private var modelSprite:Sprite;
        private var tipArr:Array;
        private var oldSJHeroID:int = 0;
        private var list1:Array;
        private var list2:Array;
        private var curNum:int = 0;
        private var FSZ:int = 0;
        private var addCountTime:int;
        private var oldaddCountTime:int = -1;
        private var _addTimeID:uint = 0;
        private var timer2:Timer;
        private var oldSelectId:int = 0;
        private var oldJiHuoid:int = 0;
        private var _mc:XMLMovieClip;
        private var _timedID:uint = 0;
        private var clickType:uint = 1;
        private var timeId:uint = 0;
        private var atk:int = 0;
        private var atkmax:int = 0;
        private var phydef:int = 0;
        private var phydefmax:int = 0;
        private var magdef:int = 0;
        private var magdefmax:int = 0;
        private var hp:int = 0;
        private var mp:int = 0;
        private var speed:int = 0;
        private var critrate:int = 0;
        private var oldTime:int = -1;

        public function FaShenUICtrl(param1:Function)
        {
            this.cfgHero = ConfigDictionary.data.hero;
            this.cfgHeroLimit = ConfigDictionary.data.herolimit;
            this.cfgMonsters = ConfigDictionary.data.monster;
            this.cfgSkill = ConfigDictionary.data.skill;
            this.cfgItem = ConfigDictionary.data.item;
            this.cfgStore = ConfigDictionary.data.storeNew;
            this.cfgGuanzhi = ConfigDictionary.data.guanwei;
            this.cfgMapList = ConfigDictionary.data.maplist;
            this.arrXY = [[6, 73], [6, 173], [6, 272], [6, 371], [865, 73], [865, 173], [865, 272], [865, 371]];
            this.arrXY1 = [[6, 78], [6, 172], [6, 266], [6, 359], [817, 82], [817, 175], [817, 269], [817, 363]];
            this.tipArr = ["招我吧：招上我杀怪打BOSS快一倍", "招我吧：我会火墙，刷怪速度更快", "招我吧：我的攻击更高，打BOSS更快", "招我吧：我会魔法盾，更加耐扛BOSS", "招我吧：法神家族第一个女性，我可以升级增加属性，还能美女一直相随，可挑战任何BOSS", "招我吧：我比妹妹升级增加的属性更多、外形更美、攻击更高，更加厉害", "招我吧：我是二姐，我比前面的技能等级更高，有了我，您可以解放了", "招我吧：法神家族大姐，白富美靓正点，快把我招出来吧"];
            this.list1 = [];
            this.list2 = [];
            this._close = param1;
            return;
        }// end function

        override protected function initializeView() : void
        {
            super.initializeView();
            var _loc_1:* = Control.create(FaShenControl, this);
            ModelProxy.addObserver("fashen", _loc_1);
            this.modelSprite = new Sprite();
            this.modelSprite.mouseChildren = false;
            this.modelSprite.mouseEnabled = false;
            this.addChild(this.modelSprite);
            jihuoBtn.visible = false;
            box1.visible = true;
            box2.visible = false;
            gunBox.visible = false;
            btn.visible = false;
            btnImg.visible = false;
            btnImg.url = "cs2_fashen/cz.png";
            zhanImg.visible = false;
            goumaiBtn.visible = false;
            box_arrow.visible = false;
            nextImg.visible = false;
            yjsjBtn.visible = false;
            daojishiLabel.visible = false;
            lvBox.visible = false;
            shuxingTips.visible = false;
            selectBox.mouseEnabled = false;
            this._ringTimer = new RingTimer();
            this._ringTimer.funVec.push(this.filterLight);
            box_select.blendMode = BlendMode.ADD;
            box_select.mouseEnabled = false;
            zhcs_txt.isHtml = true;
            var _loc_2:* = new Output();
            PluginManager.instance.sendToBufferServer("fashen", CMDFaShen.Init, _loc_2);
            this.initEvent();
            Label1.text = "完成<font color=\'#ef7510\'>目标1</font>或<font color=\'#ef7510\'>目标2</font>中的任意一个即可召唤";
            fszhsmLabel.toolTip = "<font color=\'#e19f21\'>法神召唤说明：</font>\n" + "1.每日上线可有多次免费召唤法神机会\n2.离线或者死亡（pvp活动中死亡除外）法神都会消失\n3.每日法神免费召唤次数用完之后可使用元宝购买出战次数\n" + "4.第一阶法神召唤次数低于5次时，每半个小时加1次，直到补满5次为止！\n5.第6、7、8阶法神召唤时有剩余召唤时间限制，剩余召唤时间倒计时完之后法神会自动消失！";
            yjsjBtn.toolTip = "优先消耗绑定金币，绑定金币不足消耗金币。";
            return;
        }// end function

        private function filterLight() : void
        {
            if (img_arrow.y < 0 || img_arrow.y > 8)
            {
                this._speed = -this._speed;
            }
            img_arrow.y = img_arrow.y + this._speed;
            return;
        }// end function

        private function initEvent() : void
        {
            closebtn.addEventListener(MouseEvent.CLICK, this.closeHandler);
            btn.addEventListener(MouseEvent.CLICK, this.chuzhanHandler);
            jihuoBtn.addEventListener(MouseEvent.CLICK, this.jihuoHandler);
            hdjb_txt.addEventListener(MouseEvent.CLICK, this.huodeHandler);
            leftList.selectHandler = new Handler(this.leftListHandler);
            rightList.selectHandler = new Handler(this.rightListHandler);
            var _loc_1:int = 1;
            while (_loc_1 <= 10)
            {
                
                (this["node" + _loc_1] as Clip).visible = false;
                (this["node" + _loc_1] as Clip).blendMode = BlendMode.ADD;
                (this["btn_" + _loc_1] as Image).name = String(_loc_1);
                (this["btn_" + _loc_1] as Image).addEventListener(MouseEvent.CLICK, this.shengjiHandler);
                (this["btn_" + _loc_1] as Image).addEventListener(MouseEvent.MOUSE_OVER, this.sjOverHandler);
                (this["btn_" + _loc_1] as Image).addEventListener(MouseEvent.MOUSE_OUT, this.onOut);
                _loc_1++;
            }
            yjsjBtn.clickHandler = new Handler(this.yjsjHandler);
            goumaiBtn.addEventListener(MouseEvent.CLICK, this.goumaiHandler);
            goumaiBtn.addEventListener(MouseEvent.MOUSE_OVER, this.onOver);
            goumaiBtn.addEventListener(MouseEvent.MOUSE_OUT, this.onOut);
            return;
        }// end function

        public function openRefresh(param1:Object) : void
        {
            this.showJinBi();
            this.showFaShenList();
            return;
        }// end function

        public function showJiHuoList(param1:Array) : void
        {
            if (!param1)
            {
                return;
            }
            this.JHHeros = param1;
            this.curJiHuoHero = this.JHHeros.length;
            this.showFaShenList();
            return;
        }// end function

        public function jihuoHero(param1:Object) : void
        {
            this.JHHeros.push(param1);
            this.curJiHuoHero = this.JHHeros.length;
            this.showFaShenList();
            return;
        }// end function

        public function showChuZhan(param1:Object, param2:int) : void
        {
            if (!this.selectHero)
            {
                return;
            }
            this.heroType = param2;
            var _loc_3:int = 0;
            while (_loc_3 < this.JHHeros.length)
            {
                
                if (int(param1.heroid) == this.JHHeros[_loc_3].heroid)
                {
                    if (param2 == 1)
                    {
                        this.zhaohuanHero = this.JHHeros[_loc_3];
                        this.zhaohuanHero.id = this.cfgHero[this.zhaohuanHero.heroid + "_" + this.zhaohuanHero.level].id;
                        zhanImg.visible = true;
                        zhanImg.x = this.arrXY[(this.selectHero.id - 1)][0];
                        zhanImg.y = this.arrXY[(this.selectHero.id - 1)][1];
                        btnImg.url = "cs2_fashen/xx.png";
                        this.showTime(2, this.JHHeros[_loc_3].time);
                    }
                    else if (param2 == 2)
                    {
                        this.zhaohuanHero = null;
                        if (this.selectHero.heroid == param1.heroid)
                        {
                            zhanImg.visible = false;
                            btnImg.url = "cs2_fashen/cz.png";
                            if (this.timer1)
                            {
                                this.oldTime = -1;
                                this.timer1.stop();
                                this.timer1.removeEventListener(TimerEvent.TIMER, this.timerHandler1);
                            }
                        }
                        WarningManager.show(80);
                    }
                    else if (param2 == 3)
                    {
                        this.zhaohuanHero = this.JHHeros[_loc_3];
                        this.zhaohuanHero.id = this.cfgHero[this.zhaohuanHero.heroid + "_" + this.zhaohuanHero.level].id;
                        this.JHHeros[_loc_3].num = param1.num;
                        btnImg.url = "cs2_fashen/xx.png";
                        zhanImg.visible = true;
                        zhanImg.x = this.arrXY[(this.selectHero.id - 1)][0];
                        zhanImg.y = this.arrXY[(this.selectHero.id - 1)][1];
                        this.showTime(2, this.JHHeros[_loc_3].time);
                    }
                }
                _loc_3++;
            }
            this.showHeroInfo();
            return;
        }// end function

        public function autoChuZhan(param1:Object) : void
        {
            var _loc_2:Object = null;
            this.heroType = 1;
            if (!this.selectHero)
            {
                return;
            }
            if (int(this.selectHero.heroid) == param1.heroid)
            {
                if (param1.heroInfoList)
                {
                    this.JHHeros.push(param1.heroInfoList[0]);
                }
                btnImg.url = "cs2_fashen/xx.png";
                zhanImg.visible = true;
                zhanImg.x = this.arrXY[(int(this.selectHero.id) - 1)][0];
                zhanImg.y = this.arrXY[(int(this.selectHero.id) - 1)][1];
            }
            for each (_loc_2 in param1.heroInfoList)
            {
                
                if (_loc_2.heroid == param1.heroid)
                {
                    this.zhaohuanHero = _loc_2;
                    this.zhaohuanHero.id = this.cfgHero[this.zhaohuanHero.heroid + "_" + this.zhaohuanHero.level].id;
                    this.showHeroInfo();
                    this.showTime(1, param1.endTime);
                    break;
                }
            }
            return;
        }// end function

        public function showShengJi(param1:Object) : void
        {
            if (!this.selectHero)
            {
                return;
            }
            this.oldJiHuoid = 0;
            this.oldSJHeroID = param1.heroInfo.heroid;
            if (this.zhaohuanHero && param1 == this.zhaohuanHero)
            {
                this.showTime(2, this.zhaohuanHero.time + param1.addtime);
            }
            var _loc_2:int = 0;
            while (_loc_2 < this.JHHeros.length)
            {
                
                if (this.JHHeros[_loc_2].heroid == param1.heroInfo.heroid)
                {
                    this.JHHeros[_loc_2].level = param1.heroInfo.level;
                    this.JHHeros[_loc_2].num = param1.heroInfo.num;
                    this.JHHeros[_loc_2].time = param1.heroInfo.time + param1.addtime;
                    this.showHeroInfo();
                }
                _loc_2++;
            }
            if (this.selectHero.heroid != param1.heroInfo.heroid)
            {
                this.clearSendHandler();
            }
            if (param1.heroInfo.level % 10 == 0)
            {
                this.clearSendHandler();
            }
            return;
        }// end function

        public function showFaShenList() : void
        {
            var _loc_1:Object = null;
            var _loc_2:Object = null;
            var _loc_3:int = 0;
            if (this.JHHeros == null)
            {
                return;
            }
            for each (_loc_1 in this.cfgHero)
            {
                
                if (_loc_1.id < 5)
                {
                    if (this.list1[(_loc_1.id - 1)] == null && _loc_1.level == 1)
                    {
                        this.list1[(_loc_1.id - 1)] = _loc_1;
                    }
                    continue;
                }
                if (this.list2[(_loc_1.id - 1)] == null && _loc_1.level == 1)
                {
                    this.list2[(_loc_1.id - 1)] = _loc_1;
                }
            }
            leftList.array = this.list1;
            leftList.renderHandler = new Handler(this.leftListRender);
            rightList.array = this.list2;
            rightList.renderHandler = new Handler(this.rightListRender);
            if (this.oldSJHeroID)
            {
                this.maxId = this.cfgHero[this.oldSJHeroID + "_1"].id;
            }
            else if (this.oldJiHuoid)
            {
                this.maxId = this.cfgHero[this.oldJiHuoid + "_1"].id;
            }
            else
            {
                for each (_loc_2 in this.JHHeros)
                {
                    
                    _loc_3 = this.cfgHero[_loc_2.heroid + "_" + _loc_2.level].id;
                    if (this.maxId < _loc_3)
                    {
                        this.maxId = _loc_3;
                    }
                }
            }
            if ((this.maxId - 1) < 4)
            {
                leftList.selectedIndex = this.maxId - 1;
                this.leftListHandler((this.maxId - 1));
            }
            else
            {
                rightList.selectedIndex = this.maxId - 5;
                this.rightListHandler(this.maxId - 5);
            }
            return;
        }// end function

        private function leftListRender(param1:Component, param2:int) : void
        {
            var head:Loader;
            var headCon:Container;
            var kejihuoImg:Image;
            var num:int;
            var jihuo:Object;
            var nameLabel:Label;
            var obj:Object;
            var limit:String;
            var limit2:String;
            var arr1:Array;
            var arr2:Array;
            var arr3:Array;
            var arr4:Array;
            var str1:String;
            var str2:String;
            var j:int;
            var arr:Array;
            var n:int;
            var ar:Array;
            var item:* = param1;
            var index:* = param2;
            var imgURL:* = new URLRequest();
            if (index < leftList.length)
            {
                headCon = item.getChildByName("headCon") as Container;
                imgURL.url = Config.getUrl("assets/images/head/" + leftList.array[index].head + ".png", ResourceType.NORMAL);
                head = new Loader();
                head.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function () : void
            {
                return;
            }// end function
            );
                head.load(imgURL);
                head.x = -8;
                head.y = 0;
                headCon.addChild(head);
                head.filters = [FilterDefine.grayFilter];
                kejihuoImg = item.getChildByName("kejihuo") as Image;
                num;
                var _loc_4:int = 0;
                var _loc_5:* = this.JHHeros;
                while (_loc_5 in _loc_4)
                {
                    
                    jihuo = _loc_5[_loc_4];
                    if (int(leftList.array[index].heroid) == jihuo.heroid)
                    {
                        head.filters = null;
                        kejihuoImg.visible = false;
                        num;
                    }
                }
                if (num == 1)
                {
                    kejihuoImg.visible = false;
                }
                else
                {
                    limit = this.cfgHeroLimit[(index + 1)].limit;
                    limit2 = this.cfgHeroLimit[(index + 1)].limit2;
                    arr1;
                    arr2;
                    arr3;
                    arr4;
                    var _loc_4:Boolean = false;
                    FaShenUtil.dadao2 = false;
                    FaShenUtil.dadao1 = _loc_4;
                    if (limit)
                    {
                        if (limit.search("&") != -1)
                        {
                            arr2 = limit.split("&");
                            j;
                            while (j < arr2.length)
                            {
                                
                                arr1.push((arr2[j] as String).split("#"));
                                j = (j + 1);
                            }
                        }
                        else
                        {
                            arr = limit.split("#");
                            arr1.push(arr);
                        }
                    }
                    if (limit2)
                    {
                        if (limit2.search("&") != -1)
                        {
                            arr4 = limit2.split("&");
                            n;
                            while (n < arr4.length)
                            {
                                
                                arr3.push((arr4[n] as String).split("#"));
                                n = (n + 1);
                            }
                        }
                        else
                        {
                            ar = limit2.split("#");
                            arr3.push(ar);
                        }
                    }
                    str1 = FaShenUtil.showLimit(arr1, this.FSZ, this.JHHeros);
                    str2 = FaShenUtil.showLimit2(arr3, this.FSZ, this.JHHeros);
                    if (str2 == "")
                    {
                        if (FaShenUtil.dadao1 == true)
                        {
                            kejihuoImg.visible = true;
                        }
                        else
                        {
                            kejihuoImg.visible = false;
                        }
                    }
                    else if (FaShenUtil.dadao1 == true || FaShenUtil.dadao2 == true)
                    {
                        kejihuoImg.visible = true;
                    }
                    else
                    {
                        kejihuoImg.visible = false;
                    }
                }
                nameLabel = item.getChildByName("nameLabel") as Label;
                var _loc_4:int = 0;
                var _loc_5:* = this.cfgMonsters;
                while (_loc_5 in _loc_4)
                {
                    
                    obj = _loc_5[_loc_4];
                    if (leftList.array[index].heroid == obj.mid)
                    {
                        nameLabel.text = obj.name;
                    }
                }
                item.addEventListener(MouseEvent.MOUSE_OUT, function () : void
            {
                ModelProxy.change("tips", "state", "close");
                return;
            }// end function
            );
                item.addEventListener(MouseEvent.MOUSE_OVER, function () : void
            {
                ModelProxy.change("tips", "normal", tipArr[index]);
                return;
            }// end function
            );
            }
            return;
        }// end function

        private function rightListRender(param1:Component, param2:int) : void
        {
            var head:Loader;
            var headCon:Container;
            var kejihuoImg:Image;
            var num:int;
            var jihuo:Object;
            var nameLabel:Label;
            var obj:Object;
            var limit:String;
            var limit2:String;
            var arr1:Array;
            var arr2:Array;
            var arr3:Array;
            var arr4:Array;
            var str1:String;
            var str2:String;
            var j:int;
            var arr:Array;
            var n:int;
            var ar:Array;
            var item:* = param1;
            var index:* = param2;
            var imgURL:* = new URLRequest();
            if (index < rightList.length)
            {
                headCon = item.getChildByName("headCon") as Container;
                if (rightList.array[index + 4].head)
                {
                    imgURL.url = Config.getUrl("assets/images/head/" + rightList.array[index + 4].head + ".png", ResourceType.NORMAL);
                    head = new Loader();
                    head.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function () : void
            {
                return;
            }// end function
            );
                    head.load(imgURL);
                    head.x = -5;
                    head.y = 0;
                    headCon.addChild(head);
                }
                kejihuoImg = item.getChildByName("kejihuo") as Image;
                if (index == 0)
                {
                    kejihuoImg.visible = true;
                }
                head.filters = [FilterDefine.grayFilter];
                num;
                var _loc_4:int = 0;
                var _loc_5:* = this.JHHeros;
                while (_loc_5 in _loc_4)
                {
                    
                    jihuo = _loc_5[_loc_4];
                    if (int(rightList.array[index + 4].heroid) == jihuo.heroid)
                    {
                        head.filters = null;
                        kejihuoImg.visible = false;
                        num;
                    }
                }
                if (num == 1)
                {
                    kejihuoImg.visible = false;
                }
                else
                {
                    limit = this.cfgHeroLimit[index + 5].limit;
                    limit2 = this.cfgHeroLimit[index + 5].limit2;
                    arr1;
                    arr2;
                    arr3;
                    arr4;
                    var _loc_4:Boolean = false;
                    FaShenUtil.dadao2 = false;
                    FaShenUtil.dadao1 = _loc_4;
                    if (limit)
                    {
                        if (limit.search("&") != -1)
                        {
                            arr2 = limit.split("&");
                            j;
                            while (j < arr2.length)
                            {
                                
                                arr1.push((arr2[j] as String).split("#"));
                                j = (j + 1);
                            }
                        }
                        else
                        {
                            arr = limit.split("#");
                            arr1.push(arr);
                        }
                    }
                    if (limit2)
                    {
                        if (limit2.search("&") != -1)
                        {
                            arr4 = limit2.split("&");
                            n;
                            while (n < arr4.length)
                            {
                                
                                arr3.push((arr4[n] as String).split("#"));
                                n = (n + 1);
                            }
                        }
                        else
                        {
                            ar = limit2.split("#");
                            arr3.push(ar);
                        }
                    }
                    str1 = FaShenUtil.showLimit(arr1, this.FSZ, this.JHHeros);
                    str2 = FaShenUtil.showLimit2(arr3, this.FSZ, this.JHHeros);
                    if (str2 == "")
                    {
                        if (FaShenUtil.dadao1 == true)
                        {
                            kejihuoImg.visible = true;
                        }
                        else
                        {
                            kejihuoImg.visible = false;
                        }
                    }
                    else if (FaShenUtil.dadao1 == true || FaShenUtil.dadao2 == true)
                    {
                        kejihuoImg.visible = true;
                    }
                    else
                    {
                        kejihuoImg.visible = false;
                    }
                }
                nameLabel = item.getChildByName("nameLabel") as Label;
                var _loc_4:int = 0;
                var _loc_5:* = this.cfgMonsters;
                while (_loc_5 in _loc_4)
                {
                    
                    obj = _loc_5[_loc_4];
                    if (rightList.array[index + 4].heroid == obj.mid)
                    {
                        nameLabel.text = obj.name;
                    }
                }
            }
            item.addEventListener(MouseEvent.MOUSE_OUT, function () : void
            {
                ModelProxy.change("tips", "state", "close");
                return;
            }// end function
            );
            item.addEventListener(MouseEvent.MOUSE_OVER, function () : void
            {
                ModelProxy.change("tips", "normal", tipArr[index + 4]);
                return;
            }// end function
            );
            return;
        }// end function

        private function leftListHandler(param1:int) : void
        {
            if (rightList.selectedIndex != -1)
            {
                rightList.selectedIndex = -1;
            }
            if (this.selectHero)
            {
                this.selectHero = null;
            }
            if (param1 == -1)
            {
                this.selectHero = leftList.array[(param1 + 1)];
            }
            else
            {
                this.selectHero = leftList.array[param1];
            }
            this.showHeroInfo();
            return;
        }// end function

        private function rightListHandler(param1:int) : void
        {
            var _loc_3:int = 0;
            if (leftList.selectedIndex != -1)
            {
                leftList.selectedIndex = -1;
            }
            var _loc_2:Boolean = false;
            if (param1 > 0)
            {
                _loc_3 = 0;
                while (_loc_3 < this.JHHeros.length)
                {
                    
                    if (int(rightList.array[(param1 - 1) + 4].heroid) == this.JHHeros[_loc_3].heroid)
                    {
                        _loc_2 = true;
                    }
                    _loc_3++;
                }
            }
            else
            {
                _loc_2 = true;
            }
            if (_loc_2 == true)
            {
                if (this.selectHero)
                {
                    this.selectHero = null;
                }
                if (param1 == -1)
                {
                    this.selectHero = rightList.array[param1 + 4 + 1];
                }
                else
                {
                    this.selectHero = rightList.array[param1 + 4];
                }
            }
            else if (_loc_2 == false)
            {
                ModelProxy.change("movetips", "error", "请先激活前一阶法神才可查看");
                return;
            }
            this.showHeroInfo();
            return;
        }// end function

        public function showJinBi() : void
        {
            var _loc_1:* = UserData.getBagData("gold");
            var _loc_2:* = UserData.getBagData("bgold");
            jinbi.text = "当前拥有金币：" + String(_loc_1 + _loc_2);
            return;
        }// end function

        public function updateRein() : void
        {
            this.showHeroInfo();
            return;
        }// end function

        public function showHeroInfo() : void
        {
            var _loc_1:Object = null;
            var _loc_2:int = 0;
            var _loc_3:int = 0;
            var _loc_4:Object = null;
            var _loc_5:Object = null;
            var _loc_6:int = 0;
            var _loc_15:Object = null;
            var _loc_18:int = 0;
            var _loc_19:Array = null;
            var _loc_20:int = 0;
            var _loc_21:Array = null;
            var _loc_22:Object = null;
            var _loc_23:int = 0;
            var _loc_24:Boolean = false;
            var _loc_25:Date = null;
            var _loc_26:int = 0;
            var _loc_27:int = 0;
            var _loc_28:int = 0;
            var _loc_29:Date = null;
            var _loc_30:int = 0;
            var _loc_31:RoleShow = null;
            var _loc_32:Label = null;
            var _loc_33:Label = null;
            var _loc_34:Object = null;
            var _loc_35:int = 0;
            var _loc_36:Label = null;
            var _loc_37:Label = null;
            if (!this.selectHero)
            {
                return;
            }
            this.showJinBi();
            var _loc_7:Boolean = false;
            while (this.modelSprite.numChildren > 0)
            {
                
                this.modelSprite.removeChildAt(0);
            }
            var _loc_8:* = this.cfgHeroLimit[this.selectHero.id].limit;
            var _loc_9:* = this.cfgHeroLimit[this.selectHero.id].limit2;
            var _loc_10:Array = [];
            var _loc_11:Array = [];
            var _loc_12:Array = [];
            var _loc_13:Array = [];
            if (_loc_8)
            {
                if (_loc_8.search("&") != -1)
                {
                    _loc_11 = _loc_8.split("&");
                    _loc_18 = 0;
                    while (_loc_18 < _loc_11.length)
                    {
                        
                        _loc_10.push((_loc_11[_loc_18] as String).split("#"));
                        _loc_18++;
                    }
                }
                else
                {
                    _loc_19 = _loc_8.split("#");
                    _loc_10.push(_loc_19);
                }
            }
            if (_loc_9)
            {
                if (_loc_9.search("&") != -1)
                {
                    _loc_13 = _loc_9.split("&");
                    _loc_20 = 0;
                    while (_loc_20 < _loc_13.length)
                    {
                        
                        _loc_12.push((_loc_13[_loc_20] as String).split("#"));
                        _loc_20++;
                    }
                }
                else
                {
                    _loc_21 = _loc_9.split("#");
                    _loc_12.push(_loc_21);
                }
            }
            var _loc_14:int = 0;
            while (_loc_14 < this.JHHeros.length)
            {
                
                if (this.JHHeros[_loc_14].heroid == this.selectHero.heroid)
                {
                    this.selectHero.level = this.JHHeros[_loc_14].level;
                    if (!this.JHHeros[_loc_14].num)
                    {
                        this.selectHero.num = 0;
                    }
                    else
                    {
                        this.selectHero.num = this.JHHeros[_loc_14].num;
                    }
                    this.selectHero.time = this.JHHeros[_loc_14].time;
                    _loc_6 = this.cfgHero[this.selectHero.heroid + "_" + this.selectHero.level].dayfightnum;
                    if (this.selectHero.num < _loc_6)
                    {
                        _loc_25 = new Date();
                        _loc_26 = _loc_25.getHours();
                        _loc_27 = _loc_25.getMinutes();
                        _loc_28 = _loc_25.getSeconds();
                        _loc_29 = new Date();
                        _loc_30 = 1800;
                        this.addCountTime = _loc_30;
                        if (this.oldaddCountTime > -1)
                        {
                            this.addCountTime = this.oldaddCountTime;
                        }
                        if (this.addCountTime > 0)
                        {
                            if (this.timer2 == null)
                            {
                                this.timer2 = new Timer(1000, 0);
                                this.timer2.start();
                                this.timer2.addEventListener(TimerEvent.TIMER, this.timerHandler2);
                            }
                            else
                            {
                                this.timer2.start();
                                this.timer2.addEventListener(TimerEvent.TIMER, this.timerHandler2);
                            }
                        }
                        else
                        {
                            if (this.timer2)
                            {
                                this.timer2.stop();
                                this.timer2.removeEventListener(TimerEvent.TIMER, this.timerHandler2);
                            }
                            zhcs_txt.text = "今日剩余召唤次数：" + this.selectHero.num;
                        }
                    }
                    else
                    {
                        if (this.addCountTime)
                        {
                            if (this.timer2)
                            {
                                this.timer2.stop();
                                this.timer2.removeEventListener(TimerEvent.TIMER, this.timerHandler2);
                            }
                        }
                        zhcs_txt.text = "今日剩余召唤次数：" + this.selectHero.num;
                    }
                    this.curNum = this.selectHero.num;
                    _loc_7 = true;
                    var _loc_38:Boolean = false;
                    box1.visible = false;
                    jihuoBtn.visible = _loc_38;
                    var _loc_38:Boolean = true;
                    btnImg.visible = true;
                    var _loc_38:* = _loc_38;
                    btn.visible = _loc_38;
                    zhcs_txt.visible = _loc_38;
                    if (int(this.selectHero.id) > 4)
                    {
                        var _loc_38:Boolean = true;
                        hdjb_txt.visible = true;
                        var _loc_38:* = _loc_38;
                        jinbi.visible = _loc_38;
                        var _loc_38:* = _loc_38;
                        zjsxCon.visible = _loc_38;
                        var _loc_38:* = _loc_38;
                        sxbg.visible = _loc_38;
                        var _loc_38:* = _loc_38;
                        sximg.visible = _loc_38;
                        var _loc_38:* = _loc_38;
                        jinbi.visible = _loc_38;
                        var _loc_38:* = _loc_38;
                        dargonImg.visible = _loc_38;
                        box2.visible = _loc_38;
                        this.showShengJiBtn(this.selectHero);
                    }
                    else
                    {
                        var _loc_38:Boolean = false;
                        hdjb_txt.visible = false;
                        var _loc_38:* = _loc_38;
                        jinbi.visible = _loc_38;
                        var _loc_38:* = _loc_38;
                        zjsxCon.visible = _loc_38;
                        var _loc_38:* = _loc_38;
                        sxbg.visible = _loc_38;
                        var _loc_38:* = _loc_38;
                        sximg.visible = _loc_38;
                        var _loc_38:* = _loc_38;
                        jinbi.visible = _loc_38;
                        var _loc_38:* = _loc_38;
                        dargonImg.visible = _loc_38;
                        box2.visible = _loc_38;
                    }
                    goumaiBtn.visible = false;
                    jihuoNeedMoney.visible = false;
                    if (this.zhaohuanHero && this.heroType == 1)
                    {
                        this.showTime(2, this.selectHero.time);
                        if (this.zhaohuanHero.heroid == this.selectHero.heroid && this.zhaohuanHero.level == this.selectHero.level)
                        {
                            btnImg.url = "cs2_fashen/xx.png";
                        }
                        else
                        {
                            btnImg.url = "cs2_fashen/cz.png";
                            daojishiLabel.visible = false;
                        }
                        zhanImg.x = this.arrXY[(this.zhaohuanHero.id - 1)][0];
                        zhanImg.y = this.arrXY[(this.zhaohuanHero.id - 1)][1];
                        zhanImg.visible = true;
                    }
                    else
                    {
                        this.zhaohuanHero = null;
                        zhanImg.visible = false;
                        btnImg.url = "cs2_fashen/cz.png";
                        daojishiLabel.visible = false;
                        if (this.timer1)
                        {
                            this.oldTime = -1;
                            this.timer1.stop();
                            this.timer1.removeEventListener(TimerEvent.TIMER, this.timerHandler1);
                        }
                    }
                    _loc_22 = UserData.getUserData();
                    _loc_23 = _loc_22.mapid;
                    _loc_24 = true;
                    for each (_loc_1 in this.cfgMapList)
                    {
                        
                        if (_loc_1.id == _loc_23 && _loc_1.hero == 0)
                        {
                            _loc_24 = false;
                            break;
                        }
                    }
                    if (_loc_24)
                    {
                        btn.filters = null;
                        btnImg.filters = null;
                    }
                    else
                    {
                        zhanImg.visible = false;
                        btn.filters = [FilterDefine.grayFilter];
                        btnImg.filters = [FilterDefine.grayFilter];
                    }
                    if (int(this.selectHero.id) < 5)
                    {
                        var _loc_38:Boolean = true;
                        nextImg.visible = true;
                        fsTitleImg2.visible = _loc_38;
                        lvBox.visible = false;
                        var _loc_38:Boolean = false;
                        jinbi.visible = false;
                        xiaohaoLabel.visible = _loc_38;
                        fsTitleImg2.url = "cs2_fashen/" + (int(this.selectHero.id) + 1) + ".png";
                        _loc_2 = 0;
                        _loc_3 = 0;
                        _loc_4 = ConfigDictionary.data.monsterArms[(int(this.selectHero.heroid) + 1)];
                        if (_loc_4 == null)
                        {
                            _loc_2 = 0;
                        }
                        else
                        {
                            _loc_3 = _loc_4.wing;
                            _loc_2 = _loc_4.weapon;
                        }
                        _loc_5 = {1:{model:_loc_2}};
                        _loc_31 = new RoleShow(this.cfgMonsters[(int(this.selectHero.heroid) + 1)].model, 3, _loc_5, _loc_3, null);
                        _loc_31.x = 140 + 460 + 130;
                        _loc_31.y = 245 + 69 + 104;
                        _loc_31.mouseEnabled = false;
                        this.modelSprite.addChild(_loc_31);
                        yjsjBtn.visible = false;
                        this._ringTimer.stopTime();
                        if (box_select)
                        {
                            box_select.visible = false;
                        }
                    }
                    else
                    {
                        var _loc_38:Boolean = false;
                        nextImg.visible = false;
                        fsTitleImg2.visible = _loc_38;
                        lvBox.visible = true;
                        jinbi.visible = true;
                        xiaohaoLabel.visible = true;
                        if (int(this.selectHero.level) == 50)
                        {
                            yjsjBtn.visible = false;
                            if (box_select)
                            {
                                box_select.visible = false;
                            }
                        }
                        else if (box_select)
                        {
                            box_select.visible = true;
                        }
                        this._ringTimer.startTime();
                    }
                    if (int(this.selectHero.id) > 5)
                    {
                        gunBox.visible = true;
                    }
                    else
                    {
                        gunBox.visible = false;
                    }
                    break;
                }
                _loc_14++;
            }
            if (!_loc_7)
            {
                jinbi.visible = false;
                xiaohaoLabel.visible = false;
                if (box_select)
                {
                    box_select.visible = false;
                }
                this._ringTimer.stopTime();
                yjsjBtn.visible = false;
                if (this.selectHero.level)
                {
                    _loc_6 = this.cfgHero[this.selectHero.heroid + "_" + this.selectHero.level].dayfightnum;
                }
                zhcs_txt.text = "今日剩余召唤次数：" + _loc_6;
                zhcs_txt.visible = false;
                this.selectHero.num = this.selectHero.dayfightnum;
                if (int(this.selectHero.id) == 5)
                {
                    goumaiBtn.visible = true;
                }
                else
                {
                    goumaiBtn.visible = false;
                }
                var _loc_38:Boolean = false;
                btnImg.visible = false;
                btn.visible = _loc_38;
                var _loc_38:Boolean = false;
                hdjb_txt.visible = false;
                var _loc_38:* = _loc_38;
                zjsxCon.visible = _loc_38;
                var _loc_38:* = _loc_38;
                sxbg.visible = _loc_38;
                var _loc_38:* = _loc_38;
                sximg.visible = _loc_38;
                var _loc_38:* = _loc_38;
                jinbi.visible = _loc_38;
                var _loc_38:* = _loc_38;
                nextImg.visible = _loc_38;
                var _loc_38:* = _loc_38;
                dargonImg.visible = _loc_38;
                var _loc_38:* = _loc_38;
                box2.visible = _loc_38;
                var _loc_38:* = _loc_38;
                fsTitleImg2.visible = _loc_38;
                yjsjBtn.visible = _loc_38;
                while (limitBox.numChildren > 0)
                {
                    
                    limitBox.removeChildAt(0);
                }
                var _loc_38:Boolean = false;
                FaShenUtil.dadao2 = false;
                FaShenUtil.dadao1 = _loc_38;
                _loc_32 = new Label();
                _loc_32.font = "Simsun";
                _loc_32.align = "left";
                _loc_32.bold = true;
                _loc_32.stroke = "1";
                _loc_32.x = 30;
                _loc_32.color = MColor.New55;
                limitBox.addChild(_loc_32);
                _loc_33 = new Label();
                _loc_33.isHtml = true;
                _loc_33.font = "Simsun";
                _loc_33.align = "left";
                _loc_33.leading = 5;
                _loc_33.bold = true;
                _loc_33.stroke = "1";
                _loc_33.color = MColor.New55;
                if (FaShenUtil.showLimit2(_loc_12, this.FSZ, this.JHHeros) == "")
                {
                    Label1.visible = false;
                    _loc_33.text = FaShenUtil.showLimit(_loc_10, this.FSZ, this.JHHeros);
                    _loc_33.x = 65;
                    if (FaShenUtil.dadao1)
                    {
                        jihuoBtn.visible = true;
                    }
                    else
                    {
                        jihuoBtn.visible = false;
                    }
                }
                else
                {
                    _loc_32.text = "目标1：";
                    Label1.visible = true;
                    _loc_33.x = _loc_32.x + _loc_32.width + 5;
                    _loc_36 = new Label();
                    _loc_36.font = "Simsun";
                    _loc_36.align = "left";
                    _loc_36.bold = true;
                    _loc_36.stroke = "1";
                    _loc_36.x = 30;
                    _loc_36.color = MColor.New55;
                    _loc_36.text = "目标2：";
                    limitBox.addChild(_loc_36);
                    _loc_37 = new Label();
                    _loc_37.isHtml = true;
                    _loc_37.font = "Simsun";
                    _loc_37.align = "left";
                    _loc_37.leading = 5;
                    _loc_37.color = MColor.New55;
                    _loc_37.bold = true;
                    _loc_37.stroke = "1";
                    _loc_37.x = _loc_33.x;
                    limitBox.addChild(_loc_37);
                    _loc_33.text = FaShenUtil.showLimit(_loc_10, this.FSZ, this.JHHeros) + "\n";
                    _loc_36.y = _loc_33.y + _loc_33.height;
                    _loc_37.text = FaShenUtil.showLimit2(_loc_12, this.FSZ, this.JHHeros);
                    _loc_37.y = _loc_36.y;
                    if (FaShenUtil.dadao1 || FaShenUtil.dadao2)
                    {
                        jihuoBtn.visible = true;
                    }
                    else
                    {
                        jihuoBtn.visible = false;
                    }
                }
                limitBox.addChild(_loc_33);
                box1.visible = true;
                lvBox.visible = false;
                _loc_34 = ModelProxy.getValue("data", "bag");
                _loc_35 = _loc_34.bgold;
                if (this.selectHero.id > 4)
                {
                    if (_loc_35 >= int(this.cfgHeroLimit[this.selectHero.id].cost))
                    {
                        redImg.width = 213;
                    }
                    else
                    {
                        redImg.width = _loc_35 / int(this.cfgHeroLimit[this.selectHero.id].cost) * 213;
                    }
                    if (this.cfgHeroLimit[this.selectHero.id].cost)
                    {
                        jihuoNeedMoney.visible = true;
                        jihuoNeedMoney.text = "激活本法神需要消耗" + this.cfgHeroLimit[this.selectHero.id].cost + "绑定金币";
                    }
                    else
                    {
                        jihuoNeedMoney.visible = false;
                    }
                    nl_txt.text = "绑定金币：" + String(_loc_35) + "/" + this.cfgHeroLimit[this.selectHero.id].cost;
                }
                if (this.selectHero.id > 5)
                {
                    gunBox.visible = true;
                }
            }
            fsTitleImg.url = "cs2_fashen/" + this.selectHero.id + ".png";
            for each (_loc_15 in this.cfgMonsters)
            {
                
                if (_loc_15.mid == this.selectHero.heroid)
                {
                    this.showShuXing(_loc_15);
                }
            }
            this.showSkill(this.selectHero);
            if (this.selectHero.level < 10)
            {
                lvImg1.visible = false;
                lvImg2.url = "png.common." + this.selectHero.level;
            }
            else
            {
                lvImg1.visible = true;
                lvImg1.url = "png.common." + String(int(this.selectHero.level / 10));
                lvImg2.url = "png.common." + String(this.selectHero.level % 10);
            }
            if (this.selectHero.id == 5)
            {
                jihuoBtn.visible = false;
            }
            if (this.selectHero.id != this.oldSelectId)
            {
                TweenLite.to(selectBox, 0.2, {alpha:0, onComplete:this.tweenComp, onCompleteParams:[this.arrXY1[(int(this.selectHero.id) - 1)][0], this.arrXY1[(int(this.selectHero.id) - 1)][1]]});
            }
            while (modelCon.numChildren > 0)
            {
                
                modelCon.removeChildAt(0);
            }
            _loc_2 = 0;
            _loc_3 = 0;
            _loc_4 = ConfigDictionary.data.monsterArms[int(this.selectHero.heroid)];
            if (_loc_4 == null)
            {
                _loc_2 = 0;
            }
            else
            {
                _loc_3 = _loc_4.wing;
                _loc_2 = _loc_4.weapon;
            }
            var _loc_16:Object = {1:{model:_loc_2}};
            var _loc_17:* = new RoleShow(this.cfgMonsters[this.selectHero.heroid].model, 3, _loc_16, _loc_3, null);
            new RoleShow(this.cfgMonsters[this.selectHero.heroid].model, 3, _loc_16, _loc_3, null).x = 138 + 128;
            _loc_17.y = 104 + 197 + 48;
            modelCon.addChild(_loc_17);
            return;
        }// end function

        private function showAddCountText(param1:int) : void
        {
            if (!this.selectHero)
            {
                return;
            }
            if (param1 > 0 && this.selectHero.isadd == 1 && this.selectHero.num < 5)
            {
                zhcs_txt.text = "今日剩余召唤次数：" + this.selectHero.num + "<font color=\'#c72514\'>（" + TimeDataFormatUtil.getLeftTime2(param1) + "增加1次）</font>";
            }
            else
            {
                zhcs_txt.text = "今日剩余召唤次数：" + this.selectHero.num + "";
            }
            return;
        }// end function

        private function timerHandler2(event:TimerEvent) : void
        {
            var _loc_2:String = this;
            var _loc_3:* = this.addCountTime - 1;
            _loc_2.addCountTime = _loc_3;
            this.showAddCountText(this.addCountTime);
            this.oldaddCountTime = this.addCountTime;
            if (this.addCountTime == 0)
            {
                this.oldaddCountTime = -1;
                this.timer2.stop();
                this.timer2.removeEventListener(TimerEvent.TIMER, this.timerHandler2);
            }
            return;
        }// end function

        public function tweenComp(param1:int, param2:int) : void
        {
            selectBox.x = param1;
            selectBox.y = param2 + 6;
            TweenLite.to(selectBox, 0.3, {alpha:1});
            if (this.selectHero)
            {
                this.oldSelectId = this.selectHero.id;
            }
            return;
        }// end function

        private function showShengJiBtn(param1:Object) : void
        {
            var _loc_2:* = param1.level + 1;
            if (_loc_2 >= 50)
            {
                _loc_2 = 50;
            }
            var _loc_3:* = this.cfgHero[param1.heroid + "_" + _loc_2];
            var _loc_4:* = UserData.getBagData("gold") + UserData.getBagData("bgold");
            xiaohaoLabel.isHtml = true;
            if (_loc_4 >= int(_loc_3.money))
            {
                xiaohaoLabel.text = "下次消耗金币：" + "<font color=\'#53b436\'>" + _loc_3.money + "</font>";
            }
            else
            {
                xiaohaoLabel.text = "下次消耗金币：" + "<font color=\'#ff0000\'>" + _loc_3.money + "</font>";
            }
            var _loc_5:int = 1;
            while (_loc_5 <= 10)
            {
                
                (this["node" + _loc_5] as Clip).visible = false;
                if (int(param1.level) == 50)
                {
                    (this["node" + _loc_5] as Clip).visible = true;
                    box_arrow.visible = false;
                    if (box_select)
                    {
                        box_select.visible = false;
                    }
                }
                else if (int(param1.level) % 10 == 0)
                {
                    box_arrow.visible = true;
                    box_arrow.x = (this[("btn_" + 1)] as Image).x + 3;
                    box_arrow.y = (this[("btn_" + 1)] as Image).y + 35;
                    if (box_select)
                    {
                        box_select.visible = true;
                        box_select.x = (this[("btn_" + 1)] as Image).x + 14 + 371 + 25;
                        box_select.y = (this[("btn_" + 1)] as Image).y + 32;
                    }
                }
                else if (_loc_5 <= int(param1.level) % 10)
                {
                    (this["node" + _loc_5] as Clip).visible = true;
                    box_arrow.visible = true;
                    box_arrow.x = (this["btn_" + (_loc_5 + 1)] as Image).x + 3;
                    box_arrow.y = (this["btn_" + (_loc_5 + 1)] as Image).y + 35;
                    if (box_select)
                    {
                        box_select.visible = true;
                        box_select.x = (this["btn_" + (_loc_5 + 1)] as Image).x + 14 + 371 + 25;
                        box_select.y = (this["btn_" + (_loc_5 + 1)] as Image).y + 32;
                    }
                }
                _loc_5++;
            }
            return;
        }// end function

        private function jihuoHandler(event:MouseEvent) : void
        {
            if (!this.selectHero)
            {
                return;
            }
            var _loc_2:* = UserData.getBagData("gold") + UserData.getBagData("bgold");
            var _loc_3:* = UserData.getUserData("rein");
            var _loc_4:* = UserData.getUserData("level");
            var _loc_5:* = this.cfgHeroLimit[this.selectHero.id].cost;
            if (this.cfgHeroLimit[this.selectHero.id].cost && _loc_2 < _loc_5)
            {
                ModelProxy.change("movetips", "error", "金币不足!");
                return;
            }
            var _loc_6:* = new Output();
            new Output().writeVarInt(this.selectHero.heroid, false);
            PluginManager.instance.sendToBufferServer("fashen", CMDFaShen.JiHuo, _loc_6);
            this.oldSJHeroID = 0;
            this.oldJiHuoid = this.selectHero.heroid;
            this.showSuccess();
            return;
        }// end function

        private function showSuccess() : void
        {
            if (this._mc == null)
            {
                XMLMcManager.instance.MainuiMc("qianghuasucces1", this.getBack);
            }
            else
            {
                this.addChild(this._mc);
                this._mc.playFromTo(-1, (this._mc.totalFrame - 1), new Handler(this.doEnd1));
            }
            return;
        }// end function

        private function getBack(param1:XMLMovieClip) : void
        {
            if (param1)
            {
                this._mc = param1;
                this._mc.mouseChildren = false;
                this._mc.interval = 165;
                this._mc.mouseEnabled = false;
                this._mc.x = 350;
                this._mc.y = 20;
                this.addChild(this._mc);
                this._mc.playFromTo(-1, (this._mc.totalFrame - 1), new Handler(this.doEnd1));
            }
            return;
        }// end function

        private function doEnd1() : void
        {
            if (this._mc && this._mc.parent)
            {
                this._mc.parent.removeChild(this._mc);
            }
            return;
        }// end function

        private function chuzhanHandler(event:MouseEvent) : void
        {
            var user:Object;
            var mapid:int;
            var obj:Object;
            var e:* = event;
            btn.mouseEnabled = false;
            var output:* = new Output();
            if (btnImg.url == "cs2_fashen/cz.png")
            {
                this.zhaohuan();
            }
            else
            {
                user = UserData.getUserData();
                mapid = user.mapid;
                var _loc_3:int = 0;
                var _loc_4:* = this.cfgMapList;
                while (_loc_4 in _loc_3)
                {
                    
                    obj = _loc_4[_loc_3];
                    if (obj.id == mapid && obj.hero == 0)
                    {
                        WarningManager.show(145);
                        setTimeout(function () : void
            {
                if (_timedID > 0)
                {
                    clearTimeout(_timedID);
                    _timedID = 0;
                }
                btn.mouseEnabled = true;
                return;
            }// end function
            , 1000);
                        return;
                    }
                }
                PluginManager.instance.sendToBufferServer("fashen", CMDFaShen.AskXiuXi, output);
            }
            setTimeout(function () : void
            {
                if (_timedID > 0)
                {
                    clearTimeout(_timedID);
                    _timedID = 0;
                }
                btn.mouseEnabled = true;
                return;
            }// end function
            , 1000);
            return;
        }// end function

        public function updateMapID() : void
        {
            var _loc_4:Object = null;
            var _loc_1:* = UserData.getUserData();
            var _loc_2:* = _loc_1.mapid;
            var _loc_3:Boolean = true;
            for each (_loc_4 in this.cfgMapList)
            {
                
                if (_loc_4.id == _loc_2 && _loc_4.hero == 0)
                {
                    _loc_3 = false;
                    break;
                }
            }
            if (_loc_3)
            {
                btn.filters = null;
                btnImg.filters = null;
                if (this.zhaohuanHero)
                {
                    zhanImg.visible = true;
                }
            }
            else
            {
                zhanImg.visible = false;
                btn.filters = [FilterDefine.grayFilter];
                btnImg.filters = [FilterDefine.grayFilter];
            }
            return;
        }// end function

        private function zhaohuan() : void
        {
            var output:Output;
            var yuanbao:int;
            var user:Object;
            var mapid:int;
            var obj:Object;
            if (!this.selectHero)
            {
                return;
            }
            output = new Output();
            if (this.curNum < 1)
            {
                yuanbao = int(this.cfgHero[this.selectHero.heroid + "_" + this.selectHero.level].yuanbao);
                Alert2.show("是否花费" + String(yuanbao) + "元宝召唤？", "购买召唤", ["确定", "取消"], function (param1:int, param2:Object) : void
            {
                var _loc_3:int = 0;
                if (param1 == 0)
                {
                    _loc_3 = UserData.getBagData("money");
                    if (_loc_3 < yuanbao)
                    {
                        WarningManager.show(42);
                    }
                    else
                    {
                        output.writeVarInt(selectHero.heroid, false);
                        PluginManager.instance.sendToBufferServer("fashen", CMDFaShen.GouMai, output);
                        close();
                    }
                }
                return;
            }// end function
            );
            }
            else
            {
                user = UserData.getUserData();
                mapid = user.mapid;
                var _loc_2:int = 0;
                var _loc_3:* = this.cfgMapList;
                while (_loc_3 in _loc_2)
                {
                    
                    obj = _loc_3[_loc_2];
                    if (obj.id == mapid && obj.hero == 0)
                    {
                        WarningManager.show(53);
                        return;
                    }
                }
                output.writeVarInt(this.selectHero.heroid, false);
                output.writeByte(0);
                PluginManager.instance.sendToBufferServer("fashen", CMDFaShen.ZhaoHuan, output);
                WarningManager.show(79, [this.cfgMonsters[this.selectHero.heroid].name]);
                this.close();
            }
            return;
        }// end function

        private function shengjiHandler(event:MouseEvent) : void
        {
            var _loc_3:Number = NaN;
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            var _loc_7:Output = null;
            if (!this.selectHero)
            {
                return;
            }
            this.clickType = 1;
            var _loc_2:* = int(event.currentTarget.name);
            if (_loc_2 > int(this.selectHero.level) % 10)
            {
                _loc_3 = UserData.getBagData("gold") + UserData.getBagData("bgold");
                _loc_4 = UserData.getUserData("rein");
                _loc_5 = UserData.getUserData("level");
                _loc_6 = 0;
                if (++this.selectHero.level > 50)
                {
                    ++this.selectHero.level = 50;
                }
                if (this.cfgHero[this.selectHero.heroid + "_" + ++this.selectHero.level].money && _loc_3 < int(this.cfgHero[this.selectHero.heroid + "_" + _loc_6].money))
                {
                    ModelProxy.change("movetips", "error", "金币不足!");
                    return;
                }
                if (this.cfgHero[this.selectHero.heroid + "_" + _loc_6].rein && _loc_4 < int(this.cfgHero[this.selectHero.heroid + "_" + _loc_6].rein))
                {
                    ModelProxy.change("movetips", "error", "转生等级不足!");
                    return;
                }
                if (this.cfgHero[this.selectHero.heroid + "_" + _loc_6].rolelevel && _loc_5 < int(this.cfgHero[this.selectHero.heroid + "_" + _loc_6].rolelevel))
                {
                    ModelProxy.change("movetips", "error", "角色等级不足!");
                    return;
                }
                _loc_7 = new Output();
                _loc_7.writeVarInt(this.selectHero.heroid, false);
                PluginManager.instance.sendToBufferServer("fashen", CMDFaShen.ShengJi, _loc_7);
            }
            return;
        }// end function

        private function yjsjHandler() : void
        {
            this.clickType = 2;
            if (yjsjBtn.label == "停止升级")
            {
                this.clearSendHandler();
            }
            else if (this.timeId == 0)
            {
                this.timeId = setInterval(this.sendHandler, 400);
            }
            return;
        }// end function

        private function sendHandler() : void
        {
            if (!this.selectHero)
            {
                return;
            }
            if (this.selectHero.heroid <= 90005)
            {
                this.clearSendHandler();
                return;
            }
            if (this.selectHero.level == 50)
            {
                this.clearSendHandler();
                return;
            }
            var _loc_1:* = UserData.getBagData("gold") + UserData.getBagData("bgold");
            var _loc_2:* = UserData.getUserData("rein");
            var _loc_3:* = UserData.getUserData("level");
            if (this.cfgHero[this.selectHero.heroid + "_" + (this.selectHero.level + 1)].money && _loc_1 < int(this.cfgHero[this.selectHero.heroid + "_" + (this.selectHero.level + 1)].money))
            {
                this.clearSendHandler();
                ModelProxy.change("movetips", "error", "金币不足!");
                return;
            }
            if (this.cfgHero[this.selectHero.heroid + "_" + (this.selectHero.level + 1)].rein && _loc_2 < int(this.cfgHero[this.selectHero.heroid + "_" + (this.selectHero.level + 1)].rein))
            {
                this.clearSendHandler();
                ModelProxy.change("movetips", "error", "转生等级不足!");
                return;
            }
            if (this.cfgHero[this.selectHero.heroid + "_" + (this.selectHero.level + 1)].rolelevel && _loc_3 < int(this.cfgHero[this.selectHero.heroid + "_" + (this.selectHero.level + 1)].rolelevel))
            {
                this.clearSendHandler();
                ModelProxy.change("movetips", "error", "角色等级不足!");
                return;
            }
            yjsjBtn.label = "停止升级";
            var _loc_4:* = new Output();
            new Output().writeVarInt(this.selectHero.heroid, false);
            PluginManager.instance.sendToBufferServer("fashen", CMDFaShen.ShengJi, _loc_4);
            return;
        }// end function

        private function clearSendHandler() : void
        {
            yjsjBtn.label = "一键升级";
            if (this.timeId > 0)
            {
                clearInterval(this.timeId);
                this.timeId = 0;
            }
            return;
        }// end function

        private function goumaiHandler(event:MouseEvent) : void
        {
            var e:* = event;
            if (!this.selectHero)
            {
                return;
            }
            if (this.selectHero)
            {
                this.oldJiHuoid = this.selectHero.heroid;
            }
            this.oldSJHeroID = 0;
            var money:int;
            var yuanbao:* = ModelProxy.getValue("data", "bag.money");
            var loginday:* = ModelProxy.getValue("data", "logindaycount");
            var day:* = (this.cfgHeroLimit[5].limit as String).split("#")[1];
            if (loginday >= day)
            {
                this.jihuoHandler(null);
            }
            else if (yuanbao >= money)
            {
                Alert2.show("是否确定购买此法神？", "购买法神", ["确定", "取消"], function (param1:int, param2:Object) : void
            {
                var _loc_3:Output = null;
                if (param1 == 0)
                {
                    _loc_3 = new Output();
                    _loc_3.writeVarInt(selectHero.heroid, false);
                    PluginManager.instance.sendToBufferServer("fashen", CMDFaShen.GouMaoHero, _loc_3);
                }
                return;
            }// end function
            );
            }
            else
            {
                WarningManager.show(42);
            }
            return;
        }// end function

        public function showRightShuXing() : void
        {
            var _loc_5:int = 0;
            var _loc_6:String = null;
            this.clearShuXing();
            while (zjsxCon.numChildren > 0)
            {
                
                zjsxCon.removeChildAt(0);
            }
            var _loc_1:* = new Label();
            var _loc_2:int = 10;
            _loc_1.font = "宋体";
            _loc_1.color = 14786337;
            _loc_1.width = 120;
            _loc_1.height = 160;
            _loc_1.stroke = "1";
            _loc_1.y = _loc_2;
            _loc_1.leading = 5;
            _loc_1.isHtml = true;
            _loc_1.text = "";
            var _loc_3:* = ModelProxy.getValue("data", "fashen");
            if (!_loc_3)
            {
                return;
            }
            var _loc_4:int = 0;
            while (_loc_4 < _loc_3.length)
            {
                
                _loc_5 = 1;
                while (_loc_5 <= _loc_3[_loc_4].level)
                {
                    
                    _loc_6 = _loc_3[_loc_4].heroid + "_" + String(_loc_5);
                    this.atk = this.atk + int(this.cfgHero[_loc_6].atk);
                    this.atkmax = this.atkmax + int(this.cfgHero[_loc_6].atkmax);
                    this.phydef = this.phydef + int(this.cfgHero[_loc_6].phydef);
                    this.phydefmax = this.phydefmax + int(this.cfgHero[_loc_6].phydefmax);
                    this.magdef = this.magdef + int(this.cfgHero[_loc_6].magdef);
                    this.magdefmax = this.magdefmax + int(this.cfgHero[_loc_6].magdefmax);
                    this.hp = this.hp + int(this.cfgHero[_loc_6].hp);
                    this.mp = this.mp + int(this.cfgHero[_loc_6].mp);
                    this.speed = this.speed + int(this.cfgHero[_loc_6].speed);
                    this.critrate = this.critrate + int(this.cfgHero[_loc_6].critrate);
                    _loc_5++;
                }
                _loc_4++;
            }
            if (this.atk > 0 || this.atkmax > 0)
            {
                _loc_1.text = _loc_1.text + ("物攻: " + "<font color=\'#e7dbce\'>" + this.atk + " - " + this.atkmax + "</font>\n");
                _loc_1.text = _loc_1.text + ("魔攻: " + "<font color=\'#e7dbce\'>" + this.atk + " - " + this.atkmax + "</font>\n");
                _loc_1.text = _loc_1.text + ("道攻: " + "<font color=\'#e7dbce\'>" + this.atk + " - " + this.atkmax + "</font>\n");
            }
            if (this.phydef > 0 || this.phydefmax > 0)
            {
                _loc_1.text = _loc_1.text + ("物防: " + "<font color=\'#e7dbce\'>" + this.phydef + " - " + this.phydefmax + "</font>\n");
            }
            if (this.magdef > 0 || this.magdefmax > 0)
            {
                _loc_1.text = _loc_1.text + ("魔防: " + "<font color=\'#e7dbce\'>" + this.magdef + " - " + this.magdefmax + "</font>\n");
            }
            if (this.hp > 0)
            {
                _loc_1.text = _loc_1.text + ("生命: " + "<font color=\'#e7dbce\'>" + String(int(this.hp) / 100) + "%</font>\n");
            }
            if (this.mp > 0)
            {
                _loc_1.text = _loc_1.text + ("魔法: " + "<font color=\'#e7dbce\'>" + String(int(this.mp) / 100) + "%</font>\n");
            }
            if (this.speed > 0)
            {
                _loc_1.text = _loc_1.text + ("攻速: " + "<font color=\'#e7dbce\'>" + this.speed + "</font>\n");
            }
            if (this.critrate > 0)
            {
                _loc_1.text = _loc_1.text + ("暴伤: " + "<font color=\'#e7dbce\'>" + this.critrate + "</font>\n");
            }
            zjsxCon.addChild(_loc_1);
            return;
        }// end function

        private function showSkill(param1:Object) : void
        {
            var _loc_2:* = (param1.skill as String).split("#");
            skillList.array = _loc_2;
            skillList.renderHandler = new Handler(this.skillRender);
            skillList.mouseHandler = new Handler(this.skillHandler);
            return;
        }// end function

        private function skillRender(param1:Component, param2:int) : void
        {
            var skill:Loader;
            var item:* = param1;
            var index:* = param2;
            var imgURL:* = new URLRequest();
            if (index < skillList.length)
            {
                imgURL.url = Config.getUrl("assets/images/icon/skill/" + this.cfgSkill[skillList.array[index]].icon + ".jpg", ResourceType.NORMAL);
                skill = new Loader();
                skill.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function () : void
            {
                return;
            }// end function
            );
                skill.load(imgURL);
                skill.scaleX = 0.9;
                skill.scaleY = 0.9;
                skill.x = 5;
                skill.y = 5;
                item.addChild(skill);
            }
            return;
        }// end function

        private function skillHandler(event:Event, param2:int) : void
        {
            var _loc_3:Object = null;
            if (event.type == MouseEvent.ROLL_OVER)
            {
                _loc_3 = new Object();
                _loc_3 = {cfg:this.cfgSkill[skillList.array[param2]], plus:new Object()};
                ModelProxy.change("tips", "skill", {data:_loc_3, p:new Point(GlobalLayer.instance.flashStage.mouseX, GlobalLayer.instance.flashStage.mouseY)});
            }
            else if (event.type == MouseEvent.ROLL_OUT)
            {
                ModelProxy.change("tips", "state", "close");
            }
            return;
        }// end function

        private function showShuXing(param1:Object) : void
        {
            while (fssxCon.numChildren > 0)
            {
                
                fssxCon.removeChildAt(0);
            }
            var _loc_2:String = "";
            var _loc_3:* = new Label();
            var _loc_4:int = 5;
            _loc_3.font = "宋体";
            _loc_3.color = 14786337;
            _loc_3.stroke = "1";
            _loc_3.width = 120;
            _loc_3.height = 120;
            _loc_3.x = 3;
            _loc_3.y = _loc_4;
            _loc_3.leading = 5;
            _loc_3.isHtml = true;
            if (param1.phyAtt > 0 || param1.phyAttMax > 0)
            {
                _loc_2 = _loc_2 + ("攻击: " + "<font color=\'#e7dbce\'>" + param1.phyAttMax + "</font>\n");
            }
            if (param1.phyDef > 0 || param1.phyDefMax > 0)
            {
                _loc_2 = _loc_2 + ("物防: " + "<font color=\'#e7dbce\'>" + param1.phyDefMax + "</font>\n");
            }
            if (param1.magicDef > 0 && param1.magicDefMax > 0)
            {
                _loc_2 = _loc_2 + ("魔防: " + "<font color=\'#e7dbce\'>" + param1.magicDefMax + "</font>\n");
            }
            if (param1.hp > 0)
            {
                _loc_2 = _loc_2 + ("生命: " + "<font color=\'#e7dbce\'>" + param1.hp + "</font>\n");
            }
            if (param1.mp > 0)
            {
                _loc_2 = _loc_2 + ("魔法: " + "<font color=\'#e7dbce\'>" + param1.mp + "</font>\n");
            }
            if (param1.attackSpeed > 0)
            {
                _loc_2 = _loc_2 + ("攻速: " + "<font color=\'#e7dbce\'>" + Number(100000 / param1.attackSpeed).toFixed(0) + "</font>\n");
            }
            _loc_3.text = _loc_2;
            fssxCon.addChild(_loc_3);
            return;
        }// end function

        private function showTime(param1:int, param2:int) : void
        {
            var _loc_3:int = 0;
            if (param1 == 1)
            {
                _loc_3 = int((ModelProxy.getValue("data", "servertime") + Number(getTimer())) / 1000);
                this.curtime1 = param2 - _loc_3;
            }
            else
            {
                this.curtime1 = param2;
            }
            if (this.oldTime > -1)
            {
                this.curtime1 = this.oldTime;
            }
            if (this.curtime1 > 0)
            {
                if (this.timer1 == null)
                {
                    this.timer1 = new Timer(1000, 0);
                    this.timer1.start();
                    this.timer1.addEventListener(TimerEvent.TIMER, this.timerHandler1);
                }
                else
                {
                    this.timer1.start();
                    this.timer1.addEventListener(TimerEvent.TIMER, this.timerHandler1);
                }
            }
            else
            {
                zhanImg.visible = false;
                if (int(this.zhaohuanHero.id) > 5 && int(this.selectHero.id) == int(this.zhaohuanHero.id))
                {
                    daojishiLabel.visible = true;
                    daojishiLabel.text = "出战倒计时：0小时0分0秒";
                }
                else
                {
                    daojishiLabel.visible = false;
                }
            }
            return;
        }// end function

        private function timerHandler1(event:TimerEvent) : void
        {
            var _loc_2:String = this;
            var _loc_3:* = this.curtime1 - 1;
            _loc_2.curtime1 = _loc_3;
            this.showText(this.curtime1);
            this.oldTime = this.curtime1;
            if (this.curtime1 == 0)
            {
                this.oldTime = -1;
                this.zhaohuanHero = null;
                zhanImg.visible = false;
                this.timer1.stop();
                this.timer1.removeEventListener(TimerEvent.TIMER, this.timerHandler1);
            }
            return;
        }// end function

        private function showText(param1:int) : void
        {
            if (!this.zhaohuanHero)
            {
                return;
            }
            if (param1 <= 0)
            {
                if (int(this.zhaohuanHero.id) > 4 && int(this.selectHero.id) == int(this.zhaohuanHero.id))
                {
                    daojishiLabel.text = "出战时间：0小时0分0秒";
                    daojishiLabel.visible = true;
                }
                else
                {
                    daojishiLabel.visible = false;
                }
                zhanImg.visible = false;
            }
            else if (int(this.zhaohuanHero.id) > 4 && int(this.selectHero.id) == int(this.zhaohuanHero.id))
            {
                daojishiLabel.text = "出战时间：" + TimeDataFormatUtil.getLeftTime(param1);
                daojishiLabel.visible = true;
            }
            else
            {
                daojishiLabel.visible = false;
            }
            return;
        }// end function

        private function onOver(event:MouseEvent) : void
        {
            var _loc_2:String = null;
            var _loc_3:Point = null;
            if (event.currentTarget == goumaiBtn)
            {
                _loc_3 = (event.currentTarget as Button).localToGlobal(new Point(0, 0));
                _loc_2 = "消耗8888元宝激活法神";
            }
            ModelProxy.change("tips", "normal", {data:_loc_2, p:_loc_3});
            return;
        }// end function

        private function onOut(event:MouseEvent) : void
        {
            ModelProxy.change("tips", "state", "close");
            shuxingTips.visible = false;
            return;
        }// end function

        private function huodeHandler(event:MouseEvent) : void
        {
            var _loc_2:* = (event.currentTarget as LinkButton).localToGlobal(new Point(0, 0));
            ModelProxy.change("plugin", "open", {target:"goddess", point:_loc_2});
            return;
        }// end function

        private function sjOverHandler(event:MouseEvent) : void
        {
            var _loc_8:Object = null;
            var _loc_2:* = (event.currentTarget as Image).localToGlobal(new Point(0, 0));
            var _loc_3:* = int(event.currentTarget.name);
            var _loc_4:int = 0;
            if (this.selectHero.level < 10)
            {
                _loc_4 = int(_loc_3);
            }
            else if (this.selectHero.level >= 10 && this.selectHero.level < 20)
            {
                _loc_4 = 10 + int(_loc_3);
            }
            else if (this.selectHero.level >= 20 && this.selectHero.level < 30)
            {
                _loc_4 = 20 + int(_loc_3);
            }
            else if (this.selectHero.level >= 30 && this.selectHero.level < 40)
            {
                _loc_4 = 30 + int(_loc_3);
            }
            else if (this.selectHero.level >= 40 && this.selectHero.level < 50)
            {
                _loc_4 = 40 + int(_loc_3);
            }
            else
            {
                return;
            }
            var _loc_5:* = this.selectHero.heroid + "_" + String(_loc_4);
            var _loc_6:* = new FaShenTips();
            if (this.selectHero.level >= _loc_4)
            {
                _loc_6.showTips(1, _loc_5, _loc_2);
            }
            else
            {
                _loc_6.showTips(2, _loc_5, _loc_2);
            }
            this.addChild(_loc_6);
            if (++this.selectHero.level >= 50)
            {
                ++this.selectHero.level = 50;
            }
            _loc_8 = this.cfgHero[this.selectHero.heroid + "_" + ++this.selectHero.level];
            if (_loc_4 == _loc_7)
            {
                shuxingTips.visible = true;
            }
            else
            {
                shuxingTips.visible = false;
            }
            var _loc_9:* = this.atk + int(_loc_8.atk);
            var _loc_10:* = this.atkmax + int(_loc_8.atkmax);
            var _loc_11:* = this.phydef + int(_loc_8.phydef);
            var _loc_12:* = this.phydefmax + int(_loc_8.phydefmax);
            var _loc_13:* = this.magdef + int(_loc_8.magdef);
            var _loc_14:* = this.magdefmax + int(_loc_8.magdefmax);
            var _loc_15:* = this.hp + int(_loc_8.hp);
            var _loc_16:* = this.mp + int(_loc_8.mp);
            var _loc_17:* = this.speed + int(_loc_8.speed);
            var _loc_18:* = this.critrate + int(_loc_8.critrate);
            var _loc_19:int = 110;
            if (_loc_9 > 0 || _loc_10 > 0)
            {
                sxtip1.text = _loc_9 + " - " + _loc_10;
                upImg1.visible = true;
                sxtip2.text = _loc_9 + " - " + _loc_10;
                upImg2.visible = true;
                sxtip3.text = _loc_9 + " - " + _loc_10;
                upImg3.visible = true;
            }
            else
            {
                upImg1.visible = false;
                sxtip1.text = "";
                upImg2.visible = false;
                sxtip2.text = "";
                upImg3.visible = false;
                sxtip3.text = "";
            }
            if (_loc_11 > 0 || _loc_12 > 0)
            {
                sxtip4.text = _loc_11 + " - " + _loc_12;
                upImg4.visible = true;
            }
            else
            {
                upImg4.visible = false;
                sxtip4.text = "";
            }
            if (_loc_13 > 0 || _loc_14 > 0)
            {
                sxtip5.text = _loc_13 + " - " + _loc_14;
                upImg5.visible = true;
            }
            else
            {
                upImg5.visible = false;
                sxtip5.text = "";
            }
            if (_loc_15 > 0)
            {
                sxtip6.text = String(int(_loc_15) / 100) + "%";
                upImg6.visible = true;
            }
            else
            {
                upImg6.visible = false;
                sxtip6.text = "";
            }
            if (_loc_16 > 0)
            {
                sxtip7.text = String(int(_loc_16) / 100) + "%";
                upImg7.visible = true;
            }
            else
            {
                upImg7.visible = false;
                sxtip7.text = "";
            }
            if (_loc_17 > 0)
            {
                sxtip8.text = sxtip8.text + ("攻速: " + "<font color=\'#e7dbce\'>" + this.speed + "</font>\n");
                upImg8.visible = true;
            }
            else
            {
                upImg8.visible = false;
                sxtip8.text = "";
            }
            if (_loc_18 > 0)
            {
                sxtip9.text = sxtip9.text + ("暴伤: " + "<font color=\'#e7dbce\'>" + this.critrate + "</font>\n");
                upImg9.visible = true;
            }
            else
            {
                upImg9.visible = false;
                sxtip9.text = "";
            }
            return;
        }// end function

        private function clearShuXing() : void
        {
            this.atk = 0;
            this.atkmax = 0;
            this.phydef = 0;
            this.phydefmax = 0;
            this.magdef = 0;
            this.magdefmax = 0;
            this.hp = 0;
            this.mp = 0;
            this.speed = 0;
            this.critrate = 0;
            return;
        }// end function

        private function closeHandler(event:MouseEvent) : void
        {
            this.close();
            return;
        }// end function

        private function close() : void
        {
            var _loc_1:RoleShow = null;
            var _loc_2:RoleShow = null;
            if (this._close != null)
            {
                this._close();
            }
            this._ringTimer.stopTime();
            this.clearSendHandler();
            while (this.modelSprite.numChildren > 0)
            {
                
                _loc_1 = this.modelSprite.removeChildAt(0) as RoleShow;
                if (_loc_1)
                {
                    _loc_1.destroy();
                    _loc_1 = null;
                }
            }
            while (modelCon.numChildren > 0)
            {
                
                _loc_2 = modelCon.removeChildAt(0) as RoleShow;
                if (_loc_2)
                {
                    _loc_2.destroy();
                    _loc_2 = null;
                }
            }
            this.oldJiHuoid = 0;
            this.oldSJHeroID = 0;
            return;
        }// end function

    }
}
